import move from 'az-move'

function install(Vue) {
  Vue.directive('move', {
    bind(el, binding) {
      const moveArea = binding.value ? el.querySelector(binding.value.moveArea || binding.value) || el : el
      const cursor = binding.value && binding.value.cursor
      move(el, { moveArea, cursor })
    },
  })
}

class AzMove {}
AzMove.install = install

if (window && window.Vue) {
  window.Vue.use(AzMove)
}

export default AzMove
